package cn.bookcycle.project.controller;

import cn.bookcycle.base.mapper.ProjectMapper;
import cn.bookcycle.base.mapper.UserMapper;
import cn.bookcycle.base.pojo.PO.Project;
import cn.bookcycle.base.pojo.PO.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * ProjectController
 *
 * @author Suninsky
 * @version 1.0
 * @description None
 * @email suninsky@foxmail.com
 * @date 2019/05/28
 */

@RestController
@RequestMapping("/project")
public class ProjectController {
    @Resource
    private ProjectMapper projectMapper;

    @GetMapping("/{project_name}")
    public Object testMethod(@PathVariable("project_name") String name) {
        Project project = projectMapper.selectByPrimaryKey(name);
        Map<Object,Object> result = new HashMap<>();
        result.put("code",project == null ? 1 : 0);
        result.put("project",project);
        return result;
    }
}
